package com.cordershy.controller;

import com.cordershy.pojo.income;
import com.cordershy.service.incomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class incomeController {
    @Autowired
    incomeService incomeService;
    @RequestMapping("/income/selectAll")
    public List<income> selectAll(){
        return incomeService.selectAll();
    }
    @RequestMapping("/income/selectByDate")
    public List<income> selectByDate(@RequestParam(value = "incomeyear") String incomeyear,@RequestParam(value = "incomemonth") String incomemonth,@RequestParam("username") String username){
        return incomeService.selectByDate(incomeyear,incomemonth,username);
    }
    @RequestMapping("/income/addIncome")
    public void addincome(income income){
        incomeService.addIncome(income);
    }
    @RequestMapping("/income/updateIncome")
    public void updateincome(income income){
        incomeService.updateIncome(income);
    }
    @RequestMapping("/income/deleteIncome")
    public void deleteincome(@RequestParam(value = "incomeid") int incomeid){
        incomeService.deleteIncome(incomeid);
    }
}
